package com.zhongxiangspace.service.impl;

import com.zhongxiangspace.entity.ShopsCreepData;
import com.zhongxiangspace.mapper.ShopsCreepDataMapper;
import com.zhongxiangspace.service.ShopsCreepDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 爬去的商铺数据
 */
@Service
public class ShopsCreepDataServiceImpl implements ShopsCreepDataService {


    @Autowired
    private ShopsCreepDataMapper shopsCreepDataMapper;
    /**
     * 获取所有数据
     * @return
     */
    @Override
    public List<ShopsCreepData> find() {
        return this.shopsCreepDataMapper.find();
    }

    /**
     * 保存数据
     * @param shopsCreepData
     * @return
     */
    @Override
    @Transactional
    public boolean add(ShopsCreepData shopsCreepData) {
        boolean bool=this.shopsCreepDataMapper.add(shopsCreepData);
        return bool;
    }

    /**
     * 查询该区域为null的 数据
     * @param place 区域
     * @return
     */
    @Override
    public List<ShopsCreepData> queryDetailNull(String place) {
        return this.shopsCreepDataMapper.queryDetailNull(place);
    }

    /**
     * 查询该区域为null的 数据
     * @param id
     * @return
     */
    @Override
    public ShopsCreepData queryOne(String id) {
        return this.shopsCreepDataMapper.queryOne(id);
    }

    /**
     *
     * @param shopsCreepData
     * @return
     */
    @Override
    @Transactional
    public boolean updateShopsCreepData(ShopsCreepData shopsCreepData) {
        return this.shopsCreepDataMapper.updateShopsCreepData(shopsCreepData);
    }

    /**
     * 根据爬去的url 来获取数据
     * @param url
     * @return
     */
    @Override
    public List<ShopsCreepData> queryByCreepUrl(String url) {
        return this.shopsCreepDataMapper.queryByCreepUrl(url);
    }
}
